package day15;

public class JoinDemo {
    public static void main(String[] args) {
        Mather ma=new Mather();
        ma.start();

    }



    }
class  Mather extends Thread{
    @Override
    public void run() {
        System.out.println("老妈正在烧饭");
        System.out.println("发现酱油没了");
        System.out.println("让熊孩子去打酱油。。");
        Thread son=new Son();
        son.start();
        try {
            son.join();
            System.out.println("keyishaofanle");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

class Son extends Thread{
    @Override
    public void run() {
        System.out.println("熊孩子去打酱油");
        for (int i = 5; i >=1 ; i--) {
            System.out.println("huilai");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
        System.out.println("xionghiahuilaile");
    }
}